// components/shop-nearby-item/shop-nearby-item.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    item: {
      type: Object,
      value: '',
    },
    index: {
      type: Number,
      value: 0
    },
    // button打开类型
    openType: {
      type: String,
      value: ''
    },
    isLineShow: {
      type: Boolean,
      value: true
    },
    shopId: {
      type: String,
      value: ''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    onAdd: function () {
      if (this.data.openType == 'getUserInfo') return;
      this.triggerEvent('add', null, null);
    },
    // 获取用户信息
    onGetUserInfo(res) {
      let denied = res.detail.errMsg.indexOf("auth deny") != -1;
      if (denied) return;
      let obj = {};
      obj.userInfo = res.detail.userInfo;
      obj.index = this.data.index;
      this.triggerEvent('getuserinfo', obj, null);
    }
  }
})